home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 10 / AACD 10.iso / AACD / Games / MAME / src / drivers / stactics.c < prev    next >
C/C++ Source or Header  |  2000-04-04  |  12KB  |  329 lines

  1. /****************************************************************************
  2.  
  3. Sega "Space Tactics" Driver
  4.  
  5. Frank Palazzolo (palazzol@home.com)
  6.  
  7. Master processor - Intel 8080A
  8.  
  9. Memory Map:
  10.  
  11. 0000-2fff ROM                       R
  12. 4000-47ff RAM                       R/W
  13. 5000-5fff switches/status           R
  14. 6000-6fff dips sw                   R
  15. 6000-600f Coin rjct/palette select  W
  16. 6010-601f sound triggers            W
  17. 6020-602f lamp latch                W
  18. 6030-603f speed latch               W
  19. 6040-605f shot related              W
  20. 6060-606f score display             W
  21. 60a0-60e0 sound triggers2           W
  22. 7000-7fff RNG/swit                  R     LS Nibble are a VBlank counter
  23.                                           used as a RNG
  24. 8000-8fff swit/stat                 R
  25. 8000-8fff offset RAM                W
  26. 9000-9fff V pos reg.                R     Reads counter from an encoder wheel
  27. a000-afff H pos reg.                R     Reads counter from an encoder wheel
  28. b000-bfff VRAM B                    R/W   alphanumerics, bases, barrier,
  29.                                           enemy bombs
  30. d000-dfff VRAM D                    R/W   furthest aliens (scrolling)
  31. e000-efff VRAM E                    R/W   middle aliens (scrolling)
  32. f000-ffff VRAM F                    R/W   closest aliens (scrolling)
  33.  
  34. --------------------------------------------------------------------
  35.  
  36. At this time, emulation is missing:
  37.  
  38. Lamps (Credit, Barrier, and 5 lamps for firing from the bases)
  39. Sound (all discrete and a 76447)
  40. Verify Color PROM resistor values (Last 8 colors)
  41. Verify Bar graph displays
  42.  
  43. ****************************************************************************/
  44.  
  45. #include "driver.h"
  46. #include "vidhrdw/generic.h"
  47.  
  48. /* Defined in machine/stactics.c */
  49. READ_HANDLER( stactics_port_0_r );
  50. READ_HANDLER( stactics_port_2_r );
  51. READ_HANDLER( stactics_port_3_r );
  52. READ_HANDLER( stactics_vert_pos_r );
  53. READ_HANDLER( stactics_horiz_pos_r );
  54. int stactics_interrupt(void);
  55. WRITE_HANDLER( stactics_coin_lockout_w );
  56. extern unsigned char *stactics_motor_on;
  57.  
  58. /* Defined in vidhrdw/stactics.c */
  59. int stactics_vh_start(void);
  60. void stactics_vh_stop(void);
  61. void stactics_vh_screenrefresh(struct osd_bitmap *bitmap,int full_refresh);
  62. extern unsigned char *stactics_scroll_ram;
  63. extern unsigned char *stactics_videoram_b;
  64. extern unsigned char *stactics_chardata_b;
  65. extern unsigned char *stactics_videoram_d;
  66. extern unsigned char *stactics_chardata_d;
  67. extern unsigned char *stactics_videoram_e;
  68. extern unsigned char *stactics_chardata_e;
  69. extern unsigned char *stactics_videoram_f;
  70. extern unsigned char *stactics_chardata_f;
  71. extern unsigned char *stactics_display_buffer;
  72.  
  73. void stactics_vh_convert_color_prom(unsigned char *palette, unsigned short *colortable,
  74.                                     const unsigned char *color_prom);
  75.  
  76. WRITE_HANDLER( stactics_palette_w );
  77. WRITE_HANDLER( stactics_scroll_ram_w );
  78. WRITE_HANDLER( stactics_speed_latch_w );
  79. WRITE_HANDLER( stactics_shot_trigger_w );
  80. WRITE_HANDLER( stactics_shot_flag_clear_w );
  81.  
  82. WRITE_HANDLER( stactics_videoram_b_w );
  83. WRITE_HANDLER( stactics_chardata_b_w );
  84. WRITE_HANDLER( stactics_videoram_d_w );
  85. WRITE_HANDLER( stactics_chardata_d_w );
  86. WRITE_HANDLER( stactics_videoram_e_w );
  87. WRITE_HANDLER( stactics_chardata_e_w );
  88. WRITE_HANDLER( stactics_videoram_f_w );
  89. WRITE_HANDLER( stactics_chardata_f_w );
  90.  
  91. static struct MemoryReadAddress readmem[] =
  92. {
  93.     { 0x0000, 0x2fff, MRA_ROM },
  94.     { 0x4000, 0x47ff, MRA_RAM },
  95.     { 0x5000, 0x5fff, input_port_0_r, },
  96.     { 0x6000, 0x6fff, input_port_1_r, },
  97.     { 0x7000, 0x7fff, stactics_port_2_r, },
  98.     { 0x8000, 0x8fff, stactics_port_3_r },
  99.     { 0x9000, 0x9fff, stactics_vert_pos_r },
  100.     { 0xa000, 0xafff, stactics_horiz_pos_r },
  101.  
  102.     { 0xb000, 0xb3ff, MRA_RAM },
  103.     { 0xb800, 0xbfff, MRA_RAM },
  104.  
  105.     { 0xd000, 0xd3ff, MRA_RAM },
  106.     { 0xd600, 0xd7ff, MRA_RAM },   /* Used as scratch RAM, high scores, etc. */
  107.     { 0xd800, 0xdfff, MRA_RAM },
  108.  
  109.     { 0xe000, 0xe3ff, MRA_RAM },
  110.     { 0xe600, 0xe7ff, MRA_RAM },   /* Used as scratch RAM, high scores, etc. */
  111.     { 0xe800, 0xefff, MRA_RAM },
  112.  
  113.     { 0xf000, 0xf3ff, MRA_RAM },
  114.     { 0xf600, 0xf7ff, MRA_RAM },   /* Used as scratch RAM, high scores, etc. */
  115.     { 0xf800, 0xffff, MRA_RAM },
  116.  
  117.     { -1 }    /* end of table */
  118. };
  119.  
  120. static struct MemoryWriteAddress writemem[] =
  121. {
  122.     { 0x4000, 0x47ff, MWA_RAM },
  123.     { 0x6000, 0x6001, stactics_coin_lockout_w },
  124.     { 0x6006, 0x6007, stactics_palette_w },
  125.     /* { 0x6010, 0x601f, stactics_sound_w }, */
  126.     { 0x6016, 0x6016, MWA_RAM, &stactics_motor_on },  /* Note: This overlaps rocket sound */
  127.     /* { 0x6020, 0x602f, stactics_lamp_latch_w }, */
  128.     { 0x6030, 0x603f, stactics_speed_latch_w },
  129.     { 0x6040, 0x604f, stactics_shot_trigger_w },
  130.     { 0x6050, 0x605f, stactics_shot_flag_clear_w },
  131.     { 0x6060, 0x606f, MWA_RAM, &stactics_display_buffer },
  132.     /* { 0x60a0, 0x60ef, stactics_sound2_w }, */
  133.  
  134.     { 0x8000, 0x8fff, stactics_scroll_ram_w, &stactics_scroll_ram },
  135.  
  136.     { 0xb000, 0xb3ff, stactics_videoram_b_w, &stactics_videoram_b, &videoram_size },
  137.     { 0xb400, 0xb7ff, MWA_RAM },   /* Unused, but initialized */
  138.     { 0xb800, 0xbfff, stactics_chardata_b_w, &stactics_chardata_b },
  139.  
  140.     { 0xc000, 0xcfff, MWA_NOP }, /* according to the schematics, nothing is mapped here */
  141.                                  /* but, the game still tries to clear this out         */
  142.  
  143.     { 0xd000, 0xd3ff, stactics_videoram_d_w, &stactics_videoram_d },
  144.     { 0xd400, 0xd7ff, MWA_RAM },   /* Used as scratch RAM, high scores, etc. */
  145.     { 0xd800, 0xdfff, stactics_chardata_d_w, &stactics_chardata_d },
  146.  
  147.     { 0xe000, 0xe3ff, stactics_videoram_e_w, &stactics_videoram_e },
  148.     { 0xe400, 0xe7ff, MWA_RAM },   /* Used as scratch RAM, high scores, etc. */
  149.     { 0xe800, 0xefff, stactics_chardata_e_w, &stactics_chardata_e },
  150.  
  151.     { 0xf000, 0xf3ff, stactics_videoram_f_w, &stactics_videoram_f },
  152.     { 0xf400, 0xf7ff, MWA_RAM },   /* Used as scratch RAM, high scores, etc. */
  153.     { 0xf800, 0xffff, stactics_chardata_f_w, &stactics_chardata_f },
  154.  
  155.     { -1 }    /* end of table */
  156. };
  157.  
  158. INPUT_PORTS_START( stactics )
  159.  
  160.     PORT_START  /*     IN0 */
  161.     /*PORT_BIT (0x80, IP_ACTIVE_HIGH, IPT_UNUSED ) Motor status. see stactics_port_0_r */
  162.     PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON2 )
  163.     PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_START1 )
  164.     PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON3 )
  165.     PORT_BIT (0x08, IP_ACTIVE_LOW, IPT_BUTTON4 )
  166.     PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON5 )
  167.     PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON6 )
  168.     PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON7 )
  169.  
  170.     PORT_START  /* IN1 */
  171.     PORT_DIPNAME( 0x07, 0x07, DEF_STR( Coin_B ) )
  172.     PORT_DIPSETTING(    0x01, DEF_STR( 4C_1C ) )
  173.     PORT_DIPSETTING(    0x05, DEF_STR( 2C_1C ) )
  174.     PORT_DIPSETTING(    0x07, DEF_STR( 1C_1C ) )
  175.     PORT_DIPSETTING(    0x06, DEF_STR( 1C_2C ) )
  176.     PORT_DIPSETTING(    0x04, DEF_STR( 1C_3C ) )
  177.     PORT_DIPSETTING(    0x02, DEF_STR( 1C_4C ) )
  178.     PORT_DIPSETTING(    0x00, DEF_STR( 1C_5C ) )
  179.     PORT_DIPSETTING(    0x03, DEF_STR( 1C_6C ) )
  180.     PORT_DIPNAME( 0x38, 0x38, DEF_STR( Coin_A ) )
  181.     PORT_DIPSETTING(    0x08, DEF_STR( 4C_1C ) )
  182.     PORT_DIPSETTING(    0x28, DEF_STR( 2C_1C ) )
  183.     PORT_DIPSETTING(    0x38, DEF_STR( 1C_1C ) )
  184.     PORT_DIPSETTING(    0x30, DEF_STR( 1C_2C ) )
  185.     PORT_DIPSETTING(    0x20, DEF_STR( 1C_3C ) )
  186.     PORT_DIPSETTING(    0x10, DEF_STR( 1C_4C ) )
  187.     PORT_DIPSETTING(    0x00, DEF_STR( 1C_5C ) )
  188.     PORT_DIPSETTING(    0x18, DEF_STR( 1C_6C ) )
  189.     PORT_DIPNAME( 0x40, 0x00, "High Score Initial Entry" )
  190.     PORT_DIPSETTING(    0x40, DEF_STR( Off ) )
  191.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  192.     PORT_DIPNAME( 0x80, 0x00, DEF_STR( Demo_Sounds ) )
  193.     PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
  194.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  195.  
  196.     PORT_START  /* IN2 */
  197.     /* This is accessed by stactics_port_2_r() */
  198.     /*PORT_BIT (0x0f, IP_ACTIVE_HIGH, IPT_UNUSED ) Random number generator */
  199.     PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_COIN1 )
  200.     PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_COIN2 )
  201.     PORT_DIPNAME( 0x40, 0x40, DEF_STR( Free_Play ) )
  202.     PORT_DIPSETTING( 0x40, DEF_STR( Off ) )
  203.     PORT_DIPSETTING( 0x00, DEF_STR( On ) )
  204.     PORT_SERVICE( 0x80, IP_ACTIVE_LOW )
  205.  
  206.     PORT_START  /* IN3 */
  207.     /* This is accessed by stactics_port_3_r() */
  208.     PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON1 )
  209.     /* PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_UNUSED ) */
  210.     PORT_DIPNAME( 0x04, 0x04, "Number of Barriers" )
  211.     PORT_DIPSETTING(    0x04, "4" )
  212.     PORT_DIPSETTING(    0x00, "6" )
  213.     PORT_DIPNAME( 0x08, 0x08, "Bonus Barriers" )
  214.     PORT_DIPSETTING(    0x08, "1" )
  215.     PORT_DIPSETTING(    0x00, "2" )
  216.     PORT_DIPNAME( 0x10, 0x00, "Extended Play" )
  217.     PORT_DIPSETTING(    0x10, DEF_STR( Off ) )
  218.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  219.     PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT | IPF_8WAY )
  220.     PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_8WAY )
  221.     /* PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) */
  222.  
  223.     PORT_START    /* FAKE */
  224.     PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP | IPF_8WAY )
  225.     PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN | IPF_8WAY )
  226. INPUT_PORTS_END
  227.  
  228. /* For the character graphics */
  229.  
  230. static struct GfxLayout gfxlayout =
  231. {
  232.     8,8,
  233.     256,
  234.     1,     /* 1 bit per pixel */
  235.     { 0 },
  236.     { 0, 1, 2, 3, 4, 5, 6, 7 },
  237.     { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 },
  238.     8*8
  239. };
  240.  
  241. /* For the LED Fire Beam (made up) */
  242.  
  243. static struct GfxLayout firelayout =
  244. {
  245.     16,9,
  246.     256,
  247.     1,     /* 1 bit per pixel */
  248.     { 0 },
  249.     { 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7 },
  250.     { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8, 8*8 },
  251.     8*9
  252. };
  253.  
  254. static struct GfxDecodeInfo gfxdecodeinfo[] =
  255. {
  256.     { 0, 0, &gfxlayout,  0,      64*4 },    /* Dynamically decoded from RAM */
  257.     { 0, 0, &gfxlayout,  1*2*16, 64*4 },    /* Dynamically decoded from RAM */
  258.     { 0, 0, &gfxlayout,  2*2*16, 64*4 },    /* Dynamically decoded from RAM */
  259.     { 0, 0, &gfxlayout,  3*2*16, 64*4 },    /* Dynamically decoded from RAM */
  260.     { 0, 0, &firelayout, 0, 64*4 },         /* LED Fire beam (synthesized gfx) */
  261.     { 0, 0, &gfxlayout,  0, 64*4 },         /* LED and Misc. Display characters */
  262.     { -1 }
  263. };
  264.  
  265. static struct MachineDriver machine_driver_stactics =
  266. {
  267.     /* basic machine hardware */
  268.     {
  269.         {
  270.             CPU_8080,
  271.             1933560,
  272.             readmem,writemem,0,0,
  273.             stactics_interrupt,1
  274.         },
  275.     },
  276.     60, DEFAULT_60HZ_VBLANK_DURATION,
  277.     1,
  278.     0,
  279.  
  280.     /* video hardware */
  281.     32*8, 32*8, { 0*8, 32*8-1, 0*8, 32*8-1 },
  282.     gfxdecodeinfo,
  283.     16, 16*4*4*2,
  284.     stactics_vh_convert_color_prom,
  285.  
  286.     VIDEO_TYPE_RASTER,
  287.     0,
  288.  
  289.     stactics_vh_start,
  290.     stactics_vh_stop,
  291.     stactics_vh_screenrefresh,
  292.  
  293.     /* sound hardware */
  294.     0,0,0,0
  295. };
  296.  
  297.  
  298.  
  299. /***************************************************************************
  300.  
  301.   Game driver(s)
  302.  
  303. ***************************************************************************/
  304.  
  305. ROM_START( stactics )
  306.     ROM_REGION( 0x10000, REGION_CPU1 ) /* 64k for code */
  307.     ROM_LOAD( "epr-218x",     0x0000, 0x0800, 0xb1186ad2 )
  308.     ROM_LOAD( "epr-219x",     0x0800, 0x0800, 0x3b86036d )
  309.     ROM_LOAD( "epr-220x",     0x1000, 0x0800, 0xc58702da )
  310.     ROM_LOAD( "epr-221x",     0x1800, 0x0800, 0xe327639e )
  311.     ROM_LOAD( "epr-222y",     0x2000, 0x0800, 0x24dd2bcc )
  312.     ROM_LOAD( "epr-223x",     0x2800, 0x0800, 0x7fef0940 )
  313.  
  314.     ROM_REGION( 0x1060, REGION_GFX1 | REGIONFLAG_DISPOSE )    /* gfx decoded in vh_start */
  315.     ROM_LOAD( "epr-217",      0x0000, 0x0800, 0x38259f5f )      /* LED fire beam data      */
  316.     ROM_LOAD( "pr55",         0x0800, 0x0800, 0xf162673b )      /* timing PROM (unused)    */
  317.     ROM_LOAD( "pr65",         0x1000, 0x0020, 0xa1506b9d )      /* timing PROM (unused)    */
  318.     ROM_LOAD( "pr66",         0x1020, 0x0020, 0x78dcf300 )      /* timing PROM (unused)    */
  319.     ROM_LOAD( "pr67",         0x1040, 0x0020, 0xb27874e7 )      /* LED timing ROM (unused) */
  320.  
  321.     ROM_REGION( 0x0800, REGION_PROMS )
  322.     ROM_LOAD( "pr54",         0x0000, 0x0800, 0x9640bd6e )         /* color/priority prom */
  323. ROM_END
  324.  
  325.  
  326.  
  327. GAMEX( 1981, stactics, 0, stactics, stactics, 0, ROT0, "Sega", "Space Tactics", GAME_NO_SOUND )
  328.  
  329.